#ifndef __T_ACTION_H__
#define __T_ACTION_H__

#include "T_Ref.h"
#include <functional>

enum ActionType{
	InvalidAction,
	IntervalAction,
	SequenceAction,
	MoveAction,
	AnimateAction,
	FadeAction,
	ScaleAction,
	DelayAction
};

class T_Node;
class T_Action;

typedef std::function<void()> ActionCallback;

class T_Action:public T_Ref{
protected:
	ActionCallback m_Callback;
	T_Node *m_Target;
	T_Action():m_Target(NULL){m_Callback=nullptr;}
public:
	virtual ~T_Action(){}
	T_Node *getTarget(){return m_Target;}
	void setTarget(T_Node *target){m_Target=target;}
	void onDone(){if(m_Callback!=nullptr)m_Callback();}
	void addOnDoneCallback(ActionCallback c){m_Callback=c;}
	virtual bool init(T_Node *node)=0;
	virtual void startWithTarget(T_Node *node)=0;
	virtual bool isDone()const=0;
	virtual void update(int dt)=0;
	virtual ActionType getActionType()=0;
};
#endif